<?php
	
	
	
	
	if(!isset($_SESSION['username'])){
		echo "<script>alert('请登录！');window.location.href='index.php?m=admin&c=manage'</script>";die;
	}
	
	$mid = $_GET['mid'];

	$aid = $_GET['aid'];
	



	$p = isset($_GET['p'])?$_GET['p']:1;
	
	
	$num = 10;
	//除去的条数
	$c = ($p-1)*$num;

	$rows = count(dbselect($con,'news'));

	$feild = 'news.id,news.title,news.create_time,category.category_name,news.edit';
	// $feild = '*';
	$data = dbselect($con,'news,category',$feild,'category.id=news.category_id',"news.create_time desc","{$c},{$num}");

	$page = page($con,'news',$p,$rows,$num);

/****************************************记住密码****************************/



/***********************************************************************/

	


/*********************************无刷新分页**************************************/

foreach($data as $k=>$v){
	$data[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']);


	// $data[$k]['imgsrc'] = json_decode($v['imgsrc']);
}


if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH'])=='xmlhttprequest'){

	$list['page'] = $page ;

	$list['data'] = $data ; 

	$list['imgsrc'] = IMG ;

	$list['mid'] = $mid;

	$list['aid'] = $aid;

	echo json_encode($list) ;die;



}









/***********************************************************************/
assign('con',$con);

assign('data',$data);

assign('page',$page);

//权限管理
authonity($con);
?>
	